Make All Lights a master over the zones instead of raw pixels - #21
Merged
Conversation
The 0-36 partition added in #17 owned the same pixels as the five zone lights with independent state, so turning All Lights off left a zone either physically lit (its effect repaints on its own interval) or dark while still reporting on. Rebuilds it on partition's single_light_id segment form, which wraps each zone light instead of a pixel range. AddressableLightWrapper::write_state returns early when the wrapped light's remote_values.is_on(), so a zone the user turned on is never painted over, and it drives zones with set_publish(false) so a master-driven zone never falsely reports on. The cleanup wiring from #17 is kept: all_lights_off, both on_shutdown blocks, and each play_song_* still clear the master. TRADE-OFF: the wrapper is one pixel per wrapped light, so effects selected on All Lights render as five blocks rather than a 37-LED gradient. Effects on an individual zone are unaffected. Version 26.8.27.1 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Version: 26.8.27.1
What does this implement/fix?
The
All Lightsentity added in #17 spanned pixels 0-36, which are the same pixels the five zone lights own. Two independentLightStateobjects, no reconciliation. Turn on All Lights, turn on Body Light, then turn All Lights off, and Body either stays physically lit (an effect selected on it repaints 0-23 on its own interval) or goes dark while its entity still reportson.Rebuilds the master on
partition's other segment form.single_light_idaccepts any light (partition/light.py:69iscv.use_id(light.LightState)), so the master wraps the five zone lights instead of a pixel range:AddressableLightWrapperwas built for this. Itswrite_state()opens with:so a zone the user turned on is never painted over by the master. When the master does drive a zone it uses
call.set_publish(false)andcall.set_save(false), so a master-driven zone never falsely reportsonin Home Assistant. Both failure modes above go away.The cleanup wiring from #17 is deliberately kept.
all_lights_off, bothon_shutdownblocks and eachplay_song_*still clear the master. Dropping theall_lights_offline in particular would let a master left on repaint the zones after a song ends, leaving the ornament lit.Trade-off
AddressableLightWrapper::size()returns 1, one pixel per wrapped light, so the master sees a five-pixel strip rather than 37. Solid color and brightness across the whole ornament, which is what the entity exists for, work exactly as before. An effect selected onAll Lightsnow renders as five blocks, one per zone, instead of a smooth 37-LED gradient. Effects selected on an individual zone are unaffected and still address that zone's real pixels.Types of changes
Checklist / Checklijst:
If user-visible functionality or configuration variables are added/modified:
esphome configpasses on both H-3.yaml and H-3D.yaml, and the merged config shows the master with its five wrapped segments. Not yet tested on hardware.Conflicts with #20 on the version substitution and the
all_lightsblock. Whichever merges second needs a merge frombeta.🤖 Generated with Claude Code